package leetcode.code153;

public class Solution extends Solution153 {

	@Override
	public int findMin(int[] nums) {
		int len = nums.length;
		int l = 0;
		int r = len - 1;
		while (l <= r) {
			int m = ((r - l) >> 1) + l;
			int mn = nums[m];
			int ln = nums[l];
			int rn = nums[r];
			// ln mn rn
			if (ln <= mn && mn <= rn) {
				return nums[l];
			} else if (ln < mn && mn > rn) {
				l = m + 1;
			} else if (ln > mn && mn < rn) {
				r = m;
			} else if (ln > mn && mn >= rn) {
				return nums[r];
			}
		}
		return 0;
	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();

	}

}
